<template>
  <div class="shopping-details">
    <div class="details-header">
      <div class="details-img" @click="prev">
        <img src="../assets/上一步.png" alt="">
      </div>
      <div class="details-Imgtitle">
        <img :src="imgShopUrl+$route.query.imgPath" alt="">
      </div>
    </div>
    <div class="details-title">
      <div class="details-title__body">
        <div class="details-title__item">
          {{$route.query.name}}
          <img src="../assets/右拉.png" alt="">
        </div>
        <div class="details-title__order">
          <span>评价{{$route.query.rating}}</span>
          <span>月售{{$route.query.order}}单</span>
          <span>{{$route.query.text}}约{{$route.query.time}}</span>
        </div>
        <div class="details-title__coupon">
          <div class="details-coupon__left">
            <p>18减5</p>
            <p>45减14</p>
            <p>90减23</p>
            <p>配送费优惠</p>
          </div>
          <div class="details-coupon__right" @click="show = true">
            <p>4个优惠 <img src="../assets/下箭头.png" alt=""></p>
          </div>
        </div>
        <div class="details-title__notice">
          详细地址：{{$route.query.address}}
        </div>
        <div class="details-title__nav">
          <!-- <div class="details-nav__item">
            <p>点餐</p>
          </div>
          <div class="details-nav__item">
            <p class="details-nav__color">评价</p>
          </div>
          <div class="details-nav__item">
            <p>商家</p>
          </div> -->
          <van-tabs line-width='30px' color='#2295ff' title-active-color='#333333' title-inactive-color='#666666'>
            <van-tab title="点餐"></span><Shopping-details></Shopping-details></van-tab>
            <van-tab title="评价"><Shopping-evaluate></Shopping-evaluate></van-tab>
            <van-tab title="商家"><Shopping-business></Shopping-business></van-tab>
          </van-tabs>
        </div>
      </div>
    </div>
    <van-action-sheet style="border-radius: 0px;" v-model="show" title="优惠活动">
      <div class="action-sheet">
        <div class="sheet__item" v-for="(item, index) in Discount" :key="index">
          <p>{{item.name}}</p>
          <span>{{item.description}}</span>
        </div>
      </div>
    </van-action-sheet>
  </div>
</template>

<script>
import ShoppingDetails from './ShoppingDetails.vue'
import ShoppingEvaluate from './ShoppingEvaluate.vue'
import ShoppingBusiness from './ShoppingBusiness.vue'

export default {
  name: 'ShoppingHeader',
  data () {
    return {
      show: false,
      Discount: [],
      imgShopUrl: 'https://elm.cangdu.org/img/'
    }
  },
  components: { ShoppingDetails, ShoppingEvaluate, ShoppingBusiness },
  created () {
    this.Discount = this.$route.query.active
    console.log(this.Discount)
  },
  methods: {
    prev () {
      this.$router.go(-1)
    }
  }
}
</script>

<style scoped lang=scss>
  *{
    margin: 0px;
    padding: 0px;
    list-style: none;
  }
  .shopping-details{
    width: 100%;
    height: 1600px;
    background-color: #fff;
    .details-header{
      width: 100%;
      height: 200px;
      position: relative;
      background-color: red;
      .details-Imgtitle{
        width: 150px;
        height: 150px;
        border-radius: 5px;
        position: absolute;
        top: 80px;
        left: 41%;
        img{
          width: 100%;
        }
      }
      .details-img{
        width: 100%;
        height: 60px;
        display: flex;
        align-items: center;
        img{
          width: 40px;
          margin-left: 15px;
        }
      }
    }
    .details-title{
      width: 100%;
      /* height: 354px; */
      margin-top: 33px;
      border-bottom: 1px solid #eee;
      .details-title__body{
        width: 100%;
        height: 245px;
        padding: 23px 0px;
        box-sizing: border-box;
        .details-title__item{
          width: 400px;
          margin: 0px auto;
          overflow: hidden;
          white-space:nowrap;
          text-overflow:ellipsis;
          text-align: center;
          font-size: 40px;
          font-weight: bold;
          color: #333;
          img{
            width: 26px;
          }
        }
        .details-title__order{
          width: 60%;
          height: 40px;
          margin: 0px auto;
          display: flex;
          justify-content: space-around;
          align-items: center;
          span{
            font-size: 22px;
            color: #666;
          }
        }
        .details-title__coupon{
          width: 85%;
          height: 45px;
          margin: 15px auto;
          display: flex;
          align-items: center;
          justify-content: space-between;
          .details-coupon__left{
            width: 70%;
            display: flex;
            align-items: center;
            justify-content: space-around;
            p{
              font-size: 22px;
              color: #ff4b33;
              border: 1px solid #ff4b33;
              border-radius: 3px;
              padding: 3px 8px;
              box-sizing: border-box;
            }
          }
          .details-coupon__right{
            width: 20%;
            p{
              font-size: 24px;
              color: #999;
              img{
                width: 24px;
              }
            }
          }
        }
        .details-title__notice{
          width: 90%;
          height: 60px;
          margin: 0px auto;
          line-height: 60px;
          font-size: 24px;
          color: #999;
          text-align: center;
        }
        .details-title__nav{
          width: 100%;
          height: 80px;
          margin: 20px 0px 6px 0px;
          .details-nav__item{
            width: 32%;
            height: 80px;
            display: inline-block;
            line-height: 80px;
            text-align: center;
            font-size: 32px;
            color: #666;
          }
          .details-nav__color{
            width: 65px;
            height: 80px;
            margin: 0px auto;
            color: #666;
            border-bottom: 5px solid #2295ff;
            font-weight: bold;
          }
        }
      }
    }
    .action-sheet{
      width: 85%;
      height: 430;
      padding: 16px 16px 400px;
      margin: 0px auto;
      .sheet__item{
        width: 100%;
        height: 40px;
        display: flex;
        align-items: center;
        margin-top: 20px;
        p{
          font-size: 20px;
          color: #ff4b33;
          border: 1px solid #ff4b33;
          border-radius: 3px;
          padding: 3px 8px;
          box-sizing: border-box;
        }
        span{
          font-size: 24px;
          color: #666;
          margin-left: 15px;
        }
      }
    }
  }
</style>
